package com.starry.home.logic.network

import com.starry.core.ext.await
import com.starry.home.logic.model.hospital.RegisterBean
import com.starry.home.logic.model.login.LoginBean
import com.starry.home.logic.model.login.LoginResponseBean
import com.starry.home.logic.model.login.UserInfoBean
import com.starry.home.logic.model.medical.MedicalBean

object AppNetWork {
    private val loginService = ServiceCreator.create(HomeService::class.java)
    /**
     * 登录
     */
    suspend fun login(params: LoginBean): LoginResponseBean? =
        loginService.login(params).await()

    /**
     * 注册
     */
    suspend fun register(params: LoginBean) =
        loginService.register(params).await()

    /**
     * 患者信息
     */
    suspend fun updateUserInfo(userInfo: UserInfoBean) =
        loginService.updateUserInfo(userInfo).await()

    /**
     * 获取患者信息
     */
    suspend fun getUserInfo(userId: Int) =
        loginService.getUserInfo(userId).await()

    /**
     * 科室列表
     */
    suspend fun getSectionList(params: Int) =
        loginService.getKsList(params).await()

    suspend fun getDoctorList(ysSection: String) =
        loginService.getDoctorList(ysSection).await()

    /**
     * 获取医生信息
     */
    suspend fun getYsInfo(ysId: Int) =
        loginService.getYsInfo(ysId).await()

    /**
     * 挂号
     */
    suspend fun saveRegister(registerBean: RegisterBean) =
        loginService.saveRegister(registerBean).await()

    suspend fun getRegisterList(hzId: Int) =
        loginService.getRegisterList(hzId).await()

    suspend fun getGhListByHzIdAndWeek(hzId: Int) =
        loginService.getGhListByHzIdAndWeek(hzId).await()

    suspend fun queryYsByName(params: HashMap<String, String>) =
        loginService.queryYsByName(params).await()

    suspend fun getBlIdByHzId(hzId: Int) =
        loginService.getBlIdByHzId(hzId).await()

    suspend fun getZyJdByBlId(hzId: Int) =
        loginService.getZyJdByBlId(hzId).await()

    suspend fun getXyJdByBlId(hzId: Int) =
        loginService.getXyJdByBlId(hzId).await()

    suspend fun saveBook(medical:MedicalBean.BlEntity) =
        loginService.saveBook(medical).await()
}